<?php
$connection = mysqli_connect("localhost","root","","qlpc");
 $connection->set_charset('utf8');
		$selectvalue = mysqli_real_escape_string($connection, $_GET['makhoilop']);
		 
		mysqli_select_db($connection, "qlpc");
		$result = mysqli_query($connection, "SELECT chuongtrinh.mamh,tenmh FROM chuongtrinh,monhoc WHERE nganh = '$selectvalue' AND chuongtrinh.mamh=monhoc.mamh");
		 
		echo '<option value=""></option>';
		while($row = mysqli_fetch_array($result))
		  {
			echo '<option value="'.$row['mamh'].'">' . $row['tenmh'] . "</option>";
		  }
		 
		mysqli_free_result($result);
		mysqli_close($connection);
 
?>